#include "AliasManager.h"

namespace OCPP
{
	template<> AliasManager* CSingleton<AliasManager>::msSingleton = 0;

	AliasManager::~AliasManager()
	{

	}

	AliasManager* AliasManager::getSingletonPtr(void)
	{
		return msSingleton;
	}

	AliasManager& AliasManager::getSingleton(void)
	{
		assert(msSingleton);  return (*msSingleton);
	}

	String AliasManager::getFilePath(String alias, String fileName)
	{
		return joinPath(_strPath[alias], U2A(fileName));
	}

	String AliasManager::getFile(String alias, String fileName)
	{
		String absFileName = getFilePath(alias, fileName);
		return FileUtil::getFileBinary(absFileName);
	}

	void AliasManager::setAutoMakeGZ(String alias, bool value)
	{
		_autoMakeGZ[alias] = value;
	}

	bool AliasManager::isAutoMakeGZ(String alias)
	{
		return _autoMakeGZ[alias];
	}

	bool AliasManager::registerAlias(String alias, String path)
	{
		_strPath[alias] = path;
		return true;
	}
}
